package com.shop.shopmall.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;

import java.math.BigDecimal;

/**
 * 商品属性值表
 * @TableName goods_attr_value
 */
@TableName(value ="goods_attr_value")
@Data
public class GoodsAttrValue {
    /**
     * 主键
     */
    @TableId(type = IdType.AUTO)
    private Integer id;

    /**
     * 商品ID
     */
    private Integer goodsId;

    /**
     * 商品属性索引值 (attr_value|attr_value[|....])
     */
    private String suk;

    /**
     * 属性对应的库存
     */
    private Integer stock;

    /**
     * 销量
     */
    private Integer sales;

    /**
     * 属性金额
     */
    private BigDecimal price;

    /**
     * 图片
     */
    private String image;

    /**
     * 唯一值
     */
    @TableField("`unique`")
    private String unique;

    /**
     * 成本价
     */
    private BigDecimal cost;

    /**
     * 商品条码
     */
    private String barCode;

    /**
     * 原价
     */
    private BigDecimal otPrice;

    /**
     * 重量
     */
    private BigDecimal weight;

    /**
     * 体积
     */
    private BigDecimal volume;

    /**
     * 一级返佣
     */
    private BigDecimal brokerage;

    /**
     * 二级返佣
     */
    private BigDecimal brokerageTwo;

    /**
     * 活动类型 0=商品，1=秒杀，2=砍价，3=拼团
     */
    private Integer type;

    /**
     * 活动限购数量
     */
    private Integer quota;

    /**
     * 活动限购数量显示
     */
    private Integer quotaShow;

    /**
     * attr_values 创建更新时的属性对应
     */
    private String attrValue;

    /**
     * 是否删除,0-否，1-是
     */
    private Integer isDel;

    /**
     * 并发版本控制
     */
    private Integer version;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        GoodsAttrValue other = (GoodsAttrValue) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getGoodsId() == null ? other.getGoodsId() == null : this.getGoodsId().equals(other.getGoodsId()))
            && (this.getSuk() == null ? other.getSuk() == null : this.getSuk().equals(other.getSuk()))
            && (this.getStock() == null ? other.getStock() == null : this.getStock().equals(other.getStock()))
            && (this.getSales() == null ? other.getSales() == null : this.getSales().equals(other.getSales()))
            && (this.getPrice() == null ? other.getPrice() == null : this.getPrice().equals(other.getPrice()))
            && (this.getImage() == null ? other.getImage() == null : this.getImage().equals(other.getImage()))
            && (this.getUnique() == null ? other.getUnique() == null : this.getUnique().equals(other.getUnique()))
            && (this.getCost() == null ? other.getCost() == null : this.getCost().equals(other.getCost()))
            && (this.getBarCode() == null ? other.getBarCode() == null : this.getBarCode().equals(other.getBarCode()))
            && (this.getOtPrice() == null ? other.getOtPrice() == null : this.getOtPrice().equals(other.getOtPrice()))
            && (this.getWeight() == null ? other.getWeight() == null : this.getWeight().equals(other.getWeight()))
            && (this.getVolume() == null ? other.getVolume() == null : this.getVolume().equals(other.getVolume()))
            && (this.getBrokerage() == null ? other.getBrokerage() == null : this.getBrokerage().equals(other.getBrokerage()))
            && (this.getBrokerageTwo() == null ? other.getBrokerageTwo() == null : this.getBrokerageTwo().equals(other.getBrokerageTwo()))
            && (this.getType() == null ? other.getType() == null : this.getType().equals(other.getType()))
            && (this.getQuota() == null ? other.getQuota() == null : this.getQuota().equals(other.getQuota()))
            && (this.getQuotaShow() == null ? other.getQuotaShow() == null : this.getQuotaShow().equals(other.getQuotaShow()))
            && (this.getAttrValue() == null ? other.getAttrValue() == null : this.getAttrValue().equals(other.getAttrValue()))
            && (this.getIsDel() == null ? other.getIsDel() == null : this.getIsDel().equals(other.getIsDel()))
            && (this.getVersion() == null ? other.getVersion() == null : this.getVersion().equals(other.getVersion()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getGoodsId() == null) ? 0 : getGoodsId().hashCode());
        result = prime * result + ((getSuk() == null) ? 0 : getSuk().hashCode());
        result = prime * result + ((getStock() == null) ? 0 : getStock().hashCode());
        result = prime * result + ((getSales() == null) ? 0 : getSales().hashCode());
        result = prime * result + ((getPrice() == null) ? 0 : getPrice().hashCode());
        result = prime * result + ((getImage() == null) ? 0 : getImage().hashCode());
        result = prime * result + ((getUnique() == null) ? 0 : getUnique().hashCode());
        result = prime * result + ((getCost() == null) ? 0 : getCost().hashCode());
        result = prime * result + ((getBarCode() == null) ? 0 : getBarCode().hashCode());
        result = prime * result + ((getOtPrice() == null) ? 0 : getOtPrice().hashCode());
        result = prime * result + ((getWeight() == null) ? 0 : getWeight().hashCode());
        result = prime * result + ((getVolume() == null) ? 0 : getVolume().hashCode());
        result = prime * result + ((getBrokerage() == null) ? 0 : getBrokerage().hashCode());
        result = prime * result + ((getBrokerageTwo() == null) ? 0 : getBrokerageTwo().hashCode());
        result = prime * result + ((getType() == null) ? 0 : getType().hashCode());
        result = prime * result + ((getQuota() == null) ? 0 : getQuota().hashCode());
        result = prime * result + ((getQuotaShow() == null) ? 0 : getQuotaShow().hashCode());
        result = prime * result + ((getAttrValue() == null) ? 0 : getAttrValue().hashCode());
        result = prime * result + ((getIsDel() == null) ? 0 : getIsDel().hashCode());
        result = prime * result + ((getVersion() == null) ? 0 : getVersion().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", goodsId=").append(goodsId);
        sb.append(", suk=").append(suk);
        sb.append(", stock=").append(stock);
        sb.append(", sales=").append(sales);
        sb.append(", price=").append(price);
        sb.append(", image=").append(image);
        sb.append(", unique=").append(unique);
        sb.append(", cost=").append(cost);
        sb.append(", barCode=").append(barCode);
        sb.append(", otPrice=").append(otPrice);
        sb.append(", weight=").append(weight);
        sb.append(", volume=").append(volume);
        sb.append(", brokerage=").append(brokerage);
        sb.append(", brokerageTwo=").append(brokerageTwo);
        sb.append(", type=").append(type);
        sb.append(", quota=").append(quota);
        sb.append(", quotaShow=").append(quotaShow);
        sb.append(", attrValue=").append(attrValue);
        sb.append(", isDel=").append(isDel);
        sb.append(", version=").append(version);
        sb.append("]");
        return sb.toString();
    }
}